package com.woniuxy.his.controller;


import com.woniuxy.his.common.Result;
import com.woniuxy.his.service.ICheckDetailService;
import com.woniuxy.his.service.IPatientService;
import com.woniuxy.his.service.impl.CheckDetailServiceImpl;
import com.woniuxy.his.vo.CheckDetailsVo;
import com.woniuxy.his.vo.CheckPayVo;
import com.woniuxy.his.vo.PatientByCheckeIdVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 检查详情表 前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2021-08-24
 */
@RestController
@CrossOrigin("*")
@Slf4j
public class CheckDetailController {

    @Resource
    private ICheckDetailService checkDetailService;

    @Resource
    private IPatientService patientService;

    /**
     * 根据检查详情ID查询当前检查患者
     */
    @GetMapping("/inspectShoutByCheckDetailId")
    public Result inspectShoutByCheckDetailId(Integer checkDetailId) {
        log.info("传入病历id：{}", checkDetailId);

        CheckDetailsVo checkDetailsVo = checkDetailService.inspectShoutByCheckDetailId(checkDetailId);

        log.info("当前检查患者信息：{}", checkDetailsVo);
        return Result.success("40000", "查询成功！", checkDetailsVo);
    }

    @GetMapping("showCheckMsgByCheckId")
    public Result showCheckMsgByCheckId(Integer checkId) {
        log.info("检查项目id{}", checkId);
        if (checkId == null) {
            return Result.fail("40000", "空参数！", null);
        }
        List<CheckPayVo> checkPayVo = checkDetailService.showCheckMsgByCheckId(checkId);
        return Result.success("20000", "查询成功！", checkPayVo);
    }

}

